<!DOCTYPE html>
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<title th:text="|#{customer.systemTitle}-图灵谷-全局配置-全局配置|">图灵谷</title>
<div th:replace="fragments/head_admin">head</div>
</head>
<body>
	<div class="layui-layout layui-layout-admin">
		<div th:replace="fragments/nav_admin">导航栏</div>
		<div th:replace="fragments/menu_admin::menu(parent=gconfig,child=template)">菜单栏</div>
		<div class="layui-body">
			<div class="layui-main">
				<!--/***** 面包屑 *****/-->
				<div class="layui-elem-quote" style="margin-top: 10px;">
					<span class="layui-breadcrumb"> <a><cite>全局配置</cite></a> <a th:href="@{/admin/m/base/template/list.gsp}">模版配置</a> <a><cite>列表</cite></a>
					</span>
				</div>
				<blockquote class="layui-elem-quote layui-quote-nm" style="color: #FF5722">
					<i class="layui-icon">&#xe60b;</i> 模版配置
				</blockquote>
				<form th:action="@{/admin/m/base/template/createFile.gsp}" id="addForm" role="form" class="layui-form" action="#" method="post">
					<fieldset class="layui-elem-field layui-field-title">
						<legend>修改模板</legend>
					</fieldset>

					<input type="hidden" name="filePath" th:value="${result.filePath}" />
					<div class="layui-form-item">
						<label class="layui-form-label">模板名称：<span style="color: red">*</span></label>
						<div class="layui-input-block">
							<input name="fileName" readonly="readonly" th:value="${result.fileName}" placeholder="请输入模板名称" type="text" class="layui-input" maxLength="21" />
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">模板内容：<span style="color: red">*</span></label>
						<div class="layui-input-block" style="position: relative;">
							<div id="numDiv" style="position: absolute; left: 0; top: 0; width: 35px;">
								<textarea id="num" style="width: 35px; line-height: 20px; padding: 7px; background: #666666; overflow: hidden; border: 0; resize: none;" readonly="readonly" rows="25"></textarea>
							</div>
							<div id="contentDiv" style="padding-left: 46px;">
								<textarea onkeyup="keyUp()" onscroll="document.getElementById('num').scrollTop = this.scrollTop;" id="content" name="content" style="background: #DDDDDD; resize: none;outline:none" th:utext="${result.content}" rows="25" required class="layui-textarea"></textarea>
							</div>
						</div>
					</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="submit1">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
			</form>
		</div>
	</div>
	<div th:replace="fragments/footer_admin">底部</div>
	</div>
</body>
<div th:replace="fragments/import_js_admin">引入js</div>
</html>
<script th:inline="javascript">
    /*<![CDATA[*/
    $(function() {
        var ch = $("#contentDiv").height();
        $("#numDiv").height(ch);
        keyUp();
    })

    function keyUp() {
        var obj = document.getElementById("content");
        var str = obj.value;
        str = str.replace(/\r/gi, "");
        str = str.split("\n");
        n = str.length;
        var lineobj = document.getElementById("num");
        var num = '';
        for (var i = 1; i <= n; i++) {
            if (document.all) {
                num += i + "\r\n";
            } else {
                num += i + "\n";
            }
        }
        lineobj.value = num;
        num = "";
    }

    var form = layui.form();
    //自定义验证规则
    form.verify({
        fileName : function(value) {
            if (value.length < 1) {
                return '模版名称不能为空！';
            }
        },
        content : function(value) {
            if (value.length < 1) {
                return '模版内容不能为空！';
            }
        }
    });
    //监听提交
    form.on('submit(submit1)', function(data) {
    });
    /*]]>*/
</script>